
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define MM 2222
bool mat[MM][MM];
bool mark[MM][MM];
#define ll unsigned long long

#define MAX 10000000001ULL
int res[25];
vector<pair<pair<ll,ll>, pair<ll,ll> > > rect;
vector<ll> rows, cols;
int dr[4] = {-1,0,1,0};
int dc[4] = {0, 1, 0, -1};
void bfs(int r, int c) {
  if (mat[r][c]) return;
  queue<pair<int,int> > Q;
  Q.push(make_pair(r,c));
  while (Q.size()) {
    pair<int,int> p = Q.front(); Q.pop();
    if (mark[p.first][p.second]) continue;
//    cout << p.first << "   " << p.second << " MARKED" << endl;
    mark[p.first][p.second] = true;
//    res += (rows[p.first+1]-rows[p.first]) * (cols[p.second+1]-cols[p.second]);
    for (int k = 0; k < 4; ++k) {
      int rr = p.first + dr[k], cc = p.second + dc[k];
      if (rr < 0 or cc < 0 or rr+1 >= rows.size() or cc+1 >= cols.size())
        continue;
      if (mark[rr][cc] or mat[rr][cc]) continue;
      Q.push(make_pair(rr,cc));
    }
  }
}
void sum(ll add) {
  for (int i = 0; i < 20; ++i) {
    int mod = add % 10ULL; add/= 10ULL;
    res[i] += mod;
    int p = i;
    while (res[p] > 9) { res[p+1]++; res[p] %= 10; p++; }
  }
}

void print() {
  bool print = false;
  for (int i = 24; i >= 0; --i) {
    if (res[i]) print = true;
    if (print) printf("%d", res[i]);
  } printf("\n");
}
int main() {
  int i,j ,k;
  memset(mat, 0, sizeof(mat));
  map<ll, bool> seenRows, seenCols;
  rows.push_back(0), rows.push_back(MAX);
  seenRows[0] = seenRows[MAX] = true;
  cols.push_back(0), cols.push_back(MAX);
  seenCols[0] = seenCols[MAX] = true;

  int N; cin >> N;
  ll r = MAX/2LL, c = MAX/2LL;
  for (i = 0; i < N; ++i) {
    char ch; int len;
    cin >> ch >> len;
    ll nextr1, nextr2, nextc1, nextc2;
    if (ch == 'U') {
      nextr1 = r;
      nextc1 = c;
      nextr2 = r+len+1;
      nextc2 = c+1;
      r = r+len;
    } else if (ch == 'D') {
      nextr1 = r-len;
      nextc1 = c;
      nextr2 = r+1;
      nextc2 = c+1;
      r = r-len;
    } else if (ch == 'R') {
      nextr1 = r;
      nextc1 = c;
      nextr2 = r+1;
      nextc2 = c+len+1;
      c = c+len;
    } else {
      nextr1 = r;
      nextc1 = c-len;
      nextr2 = r+1;
      nextc2 = c+1;
      c = c-len;
    }
    
    // Here we insert the rect.
    if (!seenRows[nextr1]) {
      seenRows[nextr1] = true;
      rows.push_back(nextr1);
    } 
    if (!seenRows[nextr2]) {
      seenRows[nextr2] = true;
      rows.push_back(nextr2);
    } 
    if (!seenCols[nextc1]) {
      seenCols[nextc1] = true;
      cols.push_back(nextc1);
    } 
    if (!seenCols[nextc2]) {
      seenCols[nextc2] = true;
      cols.push_back(nextc2);
    } 
    rect.push_back(make_pair(make_pair(nextr1, nextr2),
                           make_pair(nextc1, nextc2)));
  }
  sort(rows.begin(), rows.end());
  sort(cols.begin(), cols.end());
  map<int,int> mapRows, mapCols;
  for (i = 0; i < rows.size(); ++i) mapRows[rows[i]] = i;
  for (i = 0; i < cols.size(); ++i) mapCols[cols[i]] = i;

  for (i = 0 ; i < rect.size(); ++i) {
    int indr1, indr2, indc1, indc2;
    indr1 = mapRows[rect[i].first.first];
    indr2 = mapRows[rect[i].first.second];
    indc1 = mapCols[rect[i].second.first];
    indc2 = mapCols[rect[i].second.second];
//    if ( (indr2-indr1) != 1 && indc2-indc1 != 1) while(1);
    for (int r = indr1; r < indr2; ++r) for (int c = indc1; c < indc2; ++c)
      mat[r][c] = true;
  }
  // Now we run the bfs...
  memset(mark, false, sizeof(mark));
  
  for (i = 0; i+1 < rows.size(); ++i)
    bfs(i,0),bfs(i,(int)cols.size()-2);
  for (i = 0; i+1 < cols.size(); ++i)
    bfs(0, i),bfs((int)rows.size()-2, i);


  memset(res, 0, sizeof(res));
  //print();
  for (i = 0; i + 1 < rows.size(); ++i)
    for (j = 0; j + 1 < cols.size(); ++j) {
      if (mark[i][j]) continue;
      //cout << i << "  " << j << "  " << mat[i][j] <<  endl;
      
      //cout << rows[i+1] << "  " << rows[i] << " contra cols " << cols[j+1] <<" "
       //   << cols[j] << endl;
      sum((rows[i+1]-rows[i]) * (cols[j+1]-cols[j]));
    }
  print();
  return 0;
}
